package com.gzgy.ustore.api.dao.impl;

import com.gzgy.ustore.api.common.jdbc.StatementParameter;
import com.gzgy.ustore.api.dao.OrganizationDao;
import com.gzgy.ustore.api.model.OrgTreeList;
import com.ustore.model.Organization;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class OrganizationDaoImpl extends AbstractBaseDao<Organization> implements OrganizationDao {
    @Override
    public List<OrgTreeList> orgTreeList(Integer companyId) {
        String sql = "SELECT ID,ORG_ID,ORG_NAME as name,TREE_CODE,HIGH_ORG,ORG_TYPE FROM "+this.tableName+ " WHERE COMPANY_ID = ? AND IS_DELETED=0";
        StatementParameter parameter = new StatementParameter();
        parameter.setInt(companyId);
        return queryForList(sql,OrgTreeList.class,parameter);
    }
}
